/*
 * RunTester.java
 *
 * Created on March 26, 2007, 7:11 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package edu.byu.isys413.actions;

import java.util.Random;
import javax.servlet.http.*;
import edu.byu.isys413.group1E.data.*;
import edu.byu.isys413.group1E.handlers.*;

/**This has a main method, and is created for the sole purpose of testing the handlers, BO's, and DAO's.  it has not
 *system significnce
 *
 * @author Kendall Frazier
 */
public class RunTester implements edu.byu.isys413.web.Action {
    
    /** Creates a new instance of RunTester */
    public RunTester() {
    }
  
    /** Processes a number guess */
    public String process(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HttpSession session = request.getSession();
        SaleHandler sHandler = SaleHandler.getInstance();
        
        String sku = (String)request.getParameter("sku");
        int quantity = Integer.parseInt(request.getParameter("quantity"));
        
        SaleBO saleBO = (SaleBO)sHandler.addProductToSale(sku, quantity);
        
        String description = saleBO.getDescription();
        quantity = saleBO.getQuantity();
        double totalPrice = saleBO.getPrice();
        double unitPrice = saleBO.getProduct().getPrice();
                
        request.setAttribute("description", description);
        request.setAttribute("quantity", quantity);
        request.setAttribute("totalPrice", totalPrice);
        request.setAttribute("unitPrice", unitPrice);
        
        
        return "login2.jsp";
    }//process
    
    
}//RunTester class
